var express = require('express');
var router = express.Router();
var Project = require('./../models/Project.js');
var extend = require('extend');

//获取项目的所有monitorPoints
router.get('/:prjId/monitorPoints', function (req, res) {
    req.prj
        .getMonitorPoints()
        .then(function (data) {
            res.json(data);
        });
});

//获取项目的变化量
router.get('/:prjId/recentChanges/:type/:location/:time1?/:time2?/:fuzzy?/:isDesign?', function (req, res) {
    req.params.location = decodeURIComponent(req.params.location);
    req.prj.getRecentChanges(req.params).then(function (data) {
        res.json(data);
    });
});


//获取单点的变化量
router.get('/:prjId/singlePointChange/:ptName/:startTime?/:endTime?', function (req, res) {
    req.params.ptName = decodeURIComponent(req.params.ptName);
    req.params.queryType = 'custom';
    req.prj.getSinglePointChange(req.params).then(function (data) {
        res.json(data);
    });
});
module.exports = router;
